import random, hashlib, base64

def new_skey(obj):
	ctrl = 0
	while(ctrl <= 30):
		#FIXME: use upper and lower case
		skey = base64.b64encode(hashlib.sha256(str(random.getrandbits(256))).digest(),
					random.choice(['rA','aZ','gQ','hH','hG','aR','DD'])).rstrip('==')
        	if obj.all().filter('s_key =', skey).count():
        		ctrl += 1
			continue
		return skey
	return False
